package top.szhome.framework.core.tools.util;

/**
 * @author 唐加利
 * @date 2023/7/23
 **/
public class NumberUtil {

    /**
     * 获取最大值
     * @param number
     * @param numbers
     * @return
     */
    public static int max(int number, int... numbers){
        if(numbers.length == 0){
            return number;
        }

        int result = number;
        for(int n : numbers){
            result = Math.max(result, n);
        }
        return result;
    }

    /**
     * 获取 最小值
     * @param number
     * @param numbers
     * @return
     */
    public static int min(int number, int... numbers){
        if(numbers.length == 0){
            return number;
        }

        int result = number;
        for(int n : numbers){
            result = Math.min(result, n);
        }
        return result;
    }

}
